package com.ifcreate.infowell.entity;

import lombok.Data;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * @Author chenzedeng
 * @Email yustart@foxmail.com
 * @Create 2020-10-30 2:05 下午
 */
@Data
public class Edge {

    private Long id;

    private Long source;

    private Long target;

    private String relation;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Edge edge = (Edge) o;

        return new EqualsBuilder()
                .append(id, edge.id)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .toHashCode();
    }
}
